import polars as pl
from scipy.stats import f_oneway, levene

df = pl.read_excel(r"Excel data\d8_1.xls")

x1 = df.filter(pl.col("group") == 0).select("weight")
x2 = df.filter(pl.col("group") == 1).select("weight")

# 检测方差齐性

stats, pvalue = levene(x1, x2)

print(f"F={stats}, p={pvalue}")

stats, pvalue = f_oneway(x1, x2)

print(stats)
print(pvalue)
